package com.huawei.appmarket.service.store.awk.card;

import android.content.Context;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appgallery.foundation.ui.framework.widget.LineImageView;
import com.huawei.appgallery.foundation.ui.framework.widget.button.DownloadButton;
import com.huawei.appgallery.horizontalcard.api.card.BaseHorizontalItemCard;
import com.huawei.appmarket.service.store.awk.bean.ScreenShotItemBean;
import java.util.List;
import o.cgz;
import o.chc;
import o.chy;
import o.dof;
import o.ContentManager;
import o.epv;
import o.eqx;
import o.evx;
import o.ewm.d;
import o.ewm.h;
import o.ewm.j;

public class HorizonalAppScreenShotItemCard extends BaseHorizontalItemCard {
    private LineImageView ʻ;
    private TextView ʼ;
    private TextView ʽ;
    private LineImageView ˋ;
    private ImageView ॱॱ;
    private LineImageView ᐝ;

    public HorizonalAppScreenShotItemCard(Context context) {
        super(context);
    }

    public static int ॱॱ() {
        return chc.ʽॱ();
    }

    public cgz ˏ(View view) {
        this.ˋ = (LineImageView) view.findViewById(j.ʼˋ);
        this.ʻ = (LineImageView) view.findViewById(j.ʻˋ);
        this.ᐝ = (LineImageView) view.findViewById(j.ʼˊ);
        ˋ((DownloadButton) view.findViewById(j.ᶦ));
        ˏ((ImageView) view.findViewById(j.ˏˎ));
        ॱ((TextView) view.findViewById(j.ʽ));
        this.ʽ = (TextView) view.findViewById(j.ˋ);
        this.ॱॱ = (ImageView) view.findViewById(j.ᐧʻ);
        this.ʼ = (TextView) view.findViewById(j.ㆍʼ);
        ʽ(view);
        ʼ();
        return this;
    }

    private void ʼ() {
        int dimensionPixelSize = this.ʼॱ.getResources().getDimensionPixelSize(d.ᐝˋ);
        int ˎ = (epv.ˎ(this.ʼॱ, ॱॱ(), chc.ˋ()) - (dimensionPixelSize * 2)) / 3;
        int i = (ˎ * 16) / 9;
        LayoutParams layoutParams = new LinearLayout.LayoutParams(ˎ, i);
        layoutParams.setMarginEnd(dimensionPixelSize);
        this.ˋ.setLayoutParams(layoutParams);
        this.ʻ.setLayoutParams(layoutParams);
        this.ᐝ.setLayoutParams(new LinearLayout.LayoutParams(ˎ, i));
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        if (cardBean instanceof ScreenShotItemBean) {
            ScreenShotItemBean screenShotItemBean = (ScreenShotItemBean) cardBean;
            List ʻˊ = screenShotItemBean.ʻˊ();
            if (ʻˊ != null) {
                for (int i = 0; i < ʻˊ.size(); i++) {
                    String str = (String) ʻˊ.get(i);
                    switch (i) {
                        case 0:
                            ˏ(str, this.ˋ);
                            break;
                        case 1:
                            ˏ(str, this.ʻ);
                            break;
                        case 2:
                            ˏ(str, this.ᐝ);
                            break;
                        default:
                            break;
                    }
                }
            }
            ˋ(this.ʼ, screenShotItemBean.ˋʻ());
            ॱ(screenShotItemBean);
        }
    }

    private void ˏ(String str, ImageView imageView) {
        Context ˋ = ContentManager.getInstant().getContext();
        eqx.ˋ(ˋ.getResources().getDimensionPixelSize(d.ˑ), ˋ.getResources().getDimensionPixelSize(d.ˏˏ), imageView, str, "image_default_icon");
    }

    public int ˊ() {
        return h.ˋꜞ;
    }

    public int ˎ() {
        return h.ˋꜞ;
    }

    public void ॱ(final chy o_chy) {
        OnClickListener anonymousClass2 = new evx(this) {
            final /* synthetic */ HorizonalAppScreenShotItemCard ॱ;

            public void ˋ(View view) {
                o_chy.ˏ(0, this.ॱ);
            }
        };
        this.ˋ.setOnClickListener(anonymousClass2);
        this.ʻ.setOnClickListener(anonymousClass2);
        this.ᐝ.setOnClickListener(anonymousClass2);
        ˉ().setOnClickListener(anonymousClass2);
        ʼॱ().setOnClickListener(anonymousClass2);
    }

    private void ॱ(ScreenShotItemBean screenShotItemBean) {
        if (screenShotItemBean.ٴ() != 0) {
            CharSequence ߴ = screenShotItemBean.ߴ();
            if (dof.ˋ(ߴ)) {
                this.ʽ.setText("");
            } else {
                this.ʽ.setText(ߴ);
            }
            String ՙ = screenShotItemBean.ՙ();
            if (dof.ˋ(ՙ)) {
                this.ॱॱ.setVisibility(8);
                return;
            }
            this.ॱॱ.setVisibility(0);
            eqx.ˎ(this.ॱॱ, ՙ);
            return;
        }
        this.ॱॱ.setVisibility(8);
        this.ʽ.setText(screenShotItemBean.ˏˏ());
    }
}
